<?php 
	//CORS跨域服务器端设置头信息
	header("Access-Control-Allow-Origin:*");
	$username = $_POST["username"];
	$password = $_POST["password"];
	include "connect.php";
	//查询数据库
	$sql = "SELECT username password FROM mall WHERE username = '$username' AND password = '$password'";
	$result = mysql_query($sql);
	$row = mysql_fetch_array($result,MYSQL_ASSOC);
	if($row){
		$arr = array("res_code"=>1,"res_body"=>"登录成功");
		echo json_encode($arr);
	}else{
		$arr = array("res_code"=>0,"res_body"=>"登录失败");
		echo json_encode($arr).mysql_error();
	}
	mysql_close();
 ?>